class Model:
    def __init__(self, fields, items):
        if len(fields) < len(items):
            raise Exception("fields length not equals to values length!")
        elif len(fields) > len(items):
            for i in range(len(fields) - len(items)):
                items.append(None)
        self.__field_dict = {}
        for i in range(len(fields)):
            self.__field_dict[fields[i]] = items[i]

    def to_string(self):
        for key, value in self.__field_dict.items():
            print(key, ": ", value)
        print("\n\n")

    def get_field_dict(self):
        return self.__field_dict

    def list_field_value(self):
        field_list, value_list = [], []
        for key, value in self.__field_dict.items():
            field_list.append(key)
            value_list.append(value)
        return field_list, value_list

    def get(self, field):
        if field in self.__field_dict:
            return self.__field_dict[field]
        raise Exception("wrong field!")

    def set(self, field, value):
        if field in self.__field_dict:
            self.__field_dict[field] = value
        else:
            raise Exception("wrong field!")
